﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.ComponentModel;

namespace Intel_Client_GUI
{
	public class SQLCmd :INotifyPropertyChanged
	{
		public SQLCmd(){}
		public SQLCmd(string name,string xname,string yname,string xselect,string yselect,string table,string group,string order,string title,string xtype,string charttype)
		{
			this.xName=xname;
			this.yName=yname;
			this.name=name;
			this.xselect=xselect;
			this.yselect=yselect;
			this.table=table;
			this.group=group;
			this.order=order;
			this.title=title;
			this.xtype=xtype;
			this.charttype=charttype;
		}
		public SQLCmd(System.Xml.XmlNode Cmd)
		{
			// 在此点下面插入创建对象所需的代码。
			//System.Windows.MessageBox.Show(Cmd.ChildNodes.Count.ToString());
			if(Cmd.Attributes["Name"]!=null)
				this.name=Cmd.Attributes["Name"].Value;
			if(Cmd["XName"]!=null)
				this.xName=Cmd["XName"].InnerText;
			if(Cmd["YName"]!=null)
				this.xName=Cmd["YName"].InnerText;
			if(Cmd["XSelect"]!=null)
				this.xselect=Cmd["XSelect"].InnerText;
			if(Cmd["YSelect"]!=null)
				this.yselect=Cmd["YSelect"].InnerText;
			if(Cmd["Table"]!=null)
				this.Table=Cmd["Table"].InnerText;
			if(Cmd["Group"]!=null)
				this.group=Cmd["Group"].InnerText;
			if(Cmd["Order"]!=null)
				this.order=Cmd["Order"].InnerText;
			if(Cmd["Title"]!=null)
				this.title=Cmd["Title"].InnerText;
			if(Cmd["XType"]!=null)
				this.xtype=Cmd["XType"].InnerText;
			if(Cmd["ChartType"]!=null)
				this.xtype=Cmd["ChartType"].InnerText;
			
		}
		
		public SQLCmd Clone()
		{
			return new SQLCmd(this.name,this.xName,this.yName,this.xselect,this.yselect,this.table,this.group,this.order,this.title,this.xtype,this.charttype);
		}
		
		private string name;
		private string xName;
		private string yName;
		private string xselect;
		private string yselect;
		private string table;
		private string group;
		private string order;
		private string title;
		private string xtype;
		private string charttype;
		
		public string Name
		{
			get{return this.name;}
			set{this.name=value;this.NotifyPropertyChanged("Name");}
		}
		
		public string XName
		{
			get{return this.xName;}
			set{this.xName=value;this.NotifyPropertyChanged("XName");}
		}
		
		public string YName
		{
			get{return this.yName;}
			set{this.yName=value;this.NotifyPropertyChanged("YName");}
		}
		
		public string XSelect
		{
			get{return this.xselect;}
			set{this.xselect=value;this.NotifyPropertyChanged("XSelect");}
		}
		
		public string YSelect
		{
			get{return this.yselect;}
			set{this.yselect=value;this.NotifyPropertyChanged("YSelect");}
		}
		
		public string Table
		{
			get{return this.table;}
			set{this.table=value;this.NotifyPropertyChanged("Table");}
		}
		
		public string Group
		{
			get{return this.group;}
			set{this.group=value;this.NotifyPropertyChanged("Group");}
		}
		
		public string Order
		{
			get{return this.order;}
			set{this.order=value;this.NotifyPropertyChanged("Order");}
		}
		
		public string Title
		{
			get{return this.title;}
			set{this.title=value;this.NotifyPropertyChanged("Title");}
		}
		
		public string XType
		{
			get{return this.xtype;}
			set{this.xtype=value;this.NotifyPropertyChanged("XType");}
		}
		
		public string ChartType
		{
			get{return this.charttype;}
			set{this.charttype=value;this.NotifyPropertyChanged("ChartType");}
		}
		
		#region INotifyPropertyChanged
		public event PropertyChangedEventHandler PropertyChanged;
		
		private void NotifyPropertyChanged(String info)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(info));
			}
		}
		#endregion
	}
}